// stores/global.ts (推荐文件名与 store 名称一致)
import { defineStore } from "pinia";

export const useGlobalStore = defineStore("global", {
  state: () => ({
    userPic: "https://java-pp.oss-cn-hangzhou.aliyuncs.com/img/singerPic/",
    isPlay: false, // 是否播放音乐
    url: "", // 音乐播放列表
    id: "",
    currentTime: 0, // 新增播放进度状态
    breadcrumbList: [] as any[], // 建议指定具体类型
  }),
  actions: {
    setUserPic(userPic: string) {
      this.userPic = userPic;
    },
    setIsPlay(isPlay: boolean) {
      this.isPlay = isPlay;
    },
    setCurrentTime(currentTime: number) {
      this.currentTime = currentTime;
    },
    setUrl(url: string) {
      this.url = url;
    },
    setId(id: string) {
      this.id = id;
    },
    setBreadcrumbList(list: any[]) {
      // 建议指定具体类型
      this.breadcrumbList = list;
    },
  },
});
